<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title></head>
<body>
<div id="content">
    我是接收到的内容
</div>

<script src="/js/sockjs-client/sockjs.js"></script>
<script src="/js/stomp-websocket/stomp.js"></script>
<script>
    function noticeSocket() {
        var s = new SockJS('/socket');
        var stompClient = Stomp.over(s);
        stompClient.connect({}, function () {
            console.log('notice socket connected!');
            stompClient.subscribe('/topic/notice', function (data) {
                document.getElementById('content').innerHTML = data.body;
            });
        });
    };
    noticeSocket();


</script>
</body>
</html>